<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>ArcGISTileLayerOverlay</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxQGj0PqsCtxKvarsoS-iqLdqZSKfxRdmoPmGl7Y9335WLC36wIGYa6o5Q" type="text/javascript">
        </script>
        <script type="text/javascript">
         document.write('<script type="text/javascript" src="../src/arcgislink'+(document.location.search.indexOf('packed')>-1?'_packed':'')+'.js"><'+'/script>');
        </script>
        <script type="text/javascript">
        var map;    
        function init(){
          map = new GMap2(document.getElementById("map"));
          map.setCenter(new GLatLng(45.5, -122.7), 15);
          map.addControl(new GMapTypeControl());
          map.addControl(new GLargeMapControl());
          map.addControl(new GScaleControl());
          map.enableDoubleClickZoom();
          map.enableContinuousZoom();
          map.enableScrollWheelZoom();
          addOverlay();
        }
        function addOverlay(){
          var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/ESRI_LandBase_WebMercator/MapServer';
          var ov=new ArcGISTileLayerOverlay(new ArcGISTileLayer(url,{opacity:0.4}));
          map.addOverlay(ov);
          log();
        }
        function removeOverlay(){
          var ovs=map.getArcGISOverlays();
          if (ovs.length>0)map.removeOverlay(ovs[0]);
          log();
        }
        function log(){
          GLog.write('number of Overlays: '+map.getArcGISOverlays().length);
        }
        </script>
    </head>
    <body onload="init()">
       <a href='../docs/examples.html'>More examples</a> | Use
       <a href='?packed'>Packed </a> | 
       <a href='?'> Unpacked</a> Version of the script.
       <p> This example adds a "WebMercator" based tile map as <a href="../docs/reference.html#ArcGISTileLayerOverlay">ArcGISTileLayerOverlay</a>.</p>
       <button onclick="addOverlay()">addTileLayerOverlay</button>
       <button onclick="removeOverlay()">removeTileLayerOverlay</button>
       <br/>
        <div id="map" style="width:700px; height:400px; border:1px solid #000;">
        </div>
    </body>
</html>
